<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link href="https://unpkg.com/mocha@^3/mocha.css" rel="stylesheet">
  </head>
  <body>
    <div id="mocha"></div>
    <script src="https://unpkg.com/mocha@^3/mocha.js"></script>
    <script>
      mocha.setup('bdd');

      window.TESTS_COMPLETE = false;
      window.TESTS_PASSED = 0;
      window.TESTS_FAILED = 0;

      window.onload = function () {
        var runner = mocha.run();

        runner.on('test end', function (test) {
          if (test.state === 'passed') window.TESTS_PASSED++;
          else window.TESTS_FAILED++;
        });

        runner.on('end', function () {
          window.TESTS_COMPLETE = true;
        });
      };
    </script>
    {{scripts}}
  </body>
</html>
